<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>企业微信管理后台</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../css/reset.css">
    <link rel="stylesheet" href="../../css/fonts.css">
    <link rel="stylesheet" href="../../js/bootstrap/css/bootstrap.min.css">
    <!-- bootstrap表格 -->
    <link rel="stylesheet" href="../../js/bootstrap/js/bootstrap-table-master/bootstrap-table.min.css">
    <link rel="stylesheet" href="../../js/layui/css/layui.css">
    <link rel="stylesheet" href="../../css/main.css">
</head>

<body>
    <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
    <div id="contact_cus_kpi">
        <div class="header">
            <div class="back">返回</div>
            <div class="type_select_wrapper"></div>
        </div>
        <div class="container">
            <div class="screen_wrapper">
                <form class="layui-form screen_form">
                    <div class="screen_item">
                        <span class="text">时间：</span>
                        <div class="time_wrapper">
                            <input class="layui-input" type="text" id="startDate">
                            <span class="text units">至</span>
                            <input class="layui-input" type="text" id="endDate">
                        </div>
                    </div>
                </form>
            </div>
            <div class="tab_wrapper">
                <div class="tab_item active">已分配的客户(<span class="un_assets_num">2</span>)</div>
                <div class="tab_item">已分配的群聊(<span class="un_assets_group_num">2</span>)</div>
            </div>
            <div class="un_assets_customer_wrapper">
                <div class="table_wrapper">
                    <form class="layui-form">
                        <table class="layui-table member_table">
                            <thead>
                                <tr>
                                    <th>客户名称</th>
                                    <th>描述</th>
                                    <th>接替成员</th>
                                    <th>接替成员所属部门</th>
                                    <th>分配时间</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>Mr.Fun</td>
                                    <td></td>
                                    <td>刘毅华</td>
                                    <td>长沙峰之道</td>
                                    <td>下午14:46</td>
                                </tr>
                                <tr>
                                    <td>铠</td>
                                    <td></td>
                                    <td>刘毅华</td>
                                    <td>长沙峰之道</td>
                                    <td>下午14:46</td>
                                </tr>
                                <tr>
                                    <td>毛不易</td>
                                    <td></td>
                                    <td>刘毅华</td>
                                    <td>长沙峰之道</td>
                                    <td>下午14:46</td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                    <div class="paging_style" id="paging"></div>
                </div>
            </div>
            <div class="un_assets_gourpchat_wrapper" style="display: none;">
                <div class="table_wrapper">
                    <form class="layui-form">
                        <table class="layui-table groupchat_table">
                            <thead>
                                <tr>
                                    <th>群聊</th>
                                    <th>群人数</th>
                                    <th>新群主</th>
                                    <th>新群主所属部门</th>
                                    <th>分配时间</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>群聊一</td>
                                    <td>6</td>
                                    <td>叶铠齐</td>
                                    <td>长沙峰之道</td>
                                    <td>8分钟前</td>
                                </tr>
                                <tr>
                                    <td>群聊二</td>
                                    <td>2</td>
                                    <td>叶铠齐</td>
                                    <td>长沙峰之道</td>
                                    <td>8分钟前</td>
                                </tr>
                                <tr>
                                    <td>群聊三</td>
                                    <td>1</td>
                                    <td>叶铠齐</td>
                                    <td>长沙峰之道</td>
                                    <td>8分钟前</td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                    <div class="paging_style" id="group_paging"></div>
                </div>
            </div>
        </div>
    </div>

    <script src="../../js/jquery-3.3.1.min.js"></script>
    <script src="../../js/bootstrap/js/bootstrap.min.js"></script>
    <script src="../../js/layui/layui.js"></script>
    <!-- 树形结构 -->
    <script src="../../js/proTree.js"></script>
    <!-- 图表 -->
    <script src="../../js/highcharts/highcharts.js"></script>
    <script src="../../js/highcharts/exporting.js"></script>
    <script src="../../js/highcharts/no-data-to-display.js"></script>
    <!-- 公共方法 -->
    <script src="../../js/addPerson_data/data.js"></script>
    <script>
        //获取url中的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg); //匹配目标参数
            if (r != null) return unescape(r[2]);
            return null; //返回参数值
        }
        var nav_index = getUrlParam('nav_index') // 接收到的nav_id
        var member_id = getUrlParam('id') // 接收到的成员id
        var member_name = decodeURI(getUrlParam('name')) // 接收到的成员名字
        $(".type_select_wrapper").text(member_name + '的已分配离职成员资产')
        console.log(member_id, member_name)
        layui.use('layer', function () {
            var layer = layui.layer;
            // 返回
            $(".back").click(function () {
                self.location.href = "already-distri-member.html?nav_index=" + nav_index
            })

            layui.use('form', function () {
                var form = layui.form;
                // tab 切换
                $(".tab_item").eq(0).click(function () {
                    $(this).addClass('active')
                    $(".tab_item").eq(1).removeClass('active')
                    $(".un_assets_customer_wrapper").show()
                    $(".un_assets_gourpchat_wrapper").hide()
                })
                $(".tab_item").eq(1).click(function () {
                    $(this).addClass('active')
                    $(".tab_item").eq(0).removeClass('active')
                    $(".un_assets_customer_wrapper").hide()
                    $(".un_assets_gourpchat_wrapper").show()
                })

                // 表格分页
                layui.use('laypage', function () {
                    var laypage = layui.laypage;
                    // 待分配客户 分页
                    laypage.render({
                        elem: 'paging',
                        limit: 5,
                        theme: '#E51C23',
                        count: 20, //数据总数，从服务端得到
                        jump: function (obj, first) {
                            //obj包含了当前分页的所有参数，比如：
                            console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                            console.log(obj.limit); //得到每页显示的条数
                            //首次不执行
                            if (!first) {
                                //do something
                            }
                        }
                    })
                    // 待分配群聊 分页
                    laypage.render({
                        elem: 'group_paging',
                        limit: 5,
                        theme: '#E51C23',
                        count: 20, //数据总数，从服务端得到
                        jump: function (obj, first) {
                            //obj包含了当前分页的所有参数，比如：
                            console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                            console.log(obj.limit); //得到每页显示的条数
                            //首次不执行
                            if (!first) {
                                //do something
                            }
                        }
                    })
                });


                // 时间
                var startDateValue = getPreDate(15) // 默认开始时间为前15天
                var endDateValue = getDate() // 默认结束时间为今天
                var nowDate = getDate()
                var pre_15_date = getPreDate(15)
                layui.use('laydate', function () {
                    var laydate = layui.laydate;
                    // 自定义开始日期
                    var startDate = laydate.render({
                        elem: '#startDate',
                        value: pre_15_date,
                        max: nowDate,
                        done(value, date) {
                            startDateValue = value
                            endDate.config.min = {
                                year: date.year,
                                month: date.month - 1,
                                date: date.date
                            };
                            // 执行ajax 刷新table数据
                        }
                    })

                    // 自定义结束日期
                    var endDate = laydate.render({
                        elem: '#endDate',
                        value: nowDate,
                        max: nowDate,
                        done(value, date) {
                            endDateValue = value
                            // 执行ajax 刷新table数据
                        }
                    })
                });
            })

        })
    </script>
</body>

</html>